<?php namespace app\index\model;

use think\Model;

class reg extends Model {

	protected $table = 'homeuser';
	//保存数椐
	protected $auto = [ 'ip' ];
	//自动完成时间
	protected $autoWriteTimestamp = true;

	//设置ip
	protected function setIpAttr() {
		return request()->ip();
	}

	/*
	 * 验证数椐
	 */


	public function addData() {

		$postData     = input( 'post.' );
		$homeuserData = [
			'uname'     => $postData['account'],
			'upassword' => md5( $postData['pwd'] )
		];
		$this->save( $homeuserData );

		return true;

	}
}

